<template>
  <div class="hitsshop">
    <ul class="navs">
      <li
        v-for="(item, index) in list"
        :key="index"
        @click="gotohitsdetail(item.id)"
      >
        <img :src="item.pic" alt="" />
        <p>{{ item.name }}</p>
        <p class="text">{{ item.characteristic }}</p>
        <p class="color">{{ "￥" + item.minPrice }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
import { getWholeshop } from "../../utils/api/index";
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    getWholeshop().then((res) => {
      this.list = res.data.goodsMap;
    });
  },
  methods: {
    gotohitsdetail(id) {
      this.$router.push({ path: "/hitsdetail", query: { id } });
    },
  },
};
</script>

<style lang="scss" scoped>
.hitsshop {
  width: 100%;
  .navs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    img {
      width: 3.5rem;
      height: 4.5rem;
    }
    .text {
      width: 3rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .color {
      color: red;
    }
  }
}
</style>
